package com.peakmain.wanandroid.netmodule.net;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * author: peakmain
 * createdata：2019/7/10
 * mail: 2726449200@qq.com
 * desiption:
 */
public class RxSchedulers {
    static final ObservableTransformer schedulersTransformer=new ObservableTransformer() {
        @Override
        public ObservableSource apply(Observable upstream) {

            return (upstream).subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread());
        }
    };
    public static <T> ObservableTransformer<T, T> applySchedulers() {
        return  (ObservableTransformer<T, T>)schedulersTransformer;
    }
}
